//
//  BaseTableViewCell.m
//  CatMusic
//
//  Created by dllo on 15/4/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "BaseTableViewCell.h"

#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
#import "NightMode.h"

@implementation BaseTableViewCell


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // cell图片
        self.BaseImageView = [[UIImageView alloc]init];
//        self.BaseImageView.backgroundColor = [UIColor redColor];
        [self.contentView addSubview:self.BaseImageView];
        // 歌曲顺序
        self.baseNumberLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.baseNumberLabel];
//        self.baseNumberLabel.backgroundColor = [UIColor cyanColor];
        // 歌手名字
        self.BaseSingerNameLabel = [[UILabel alloc]init];
        [self.contentView addSubview:self.BaseSingerNameLabel];
//        self.BaseSingerNameLabel.backgroundColor = [UIColor yellowColor];
//        self.BaseSingerNameLabel.textAlignment = NSTextAlignmentRight;
        // 歌曲名字
        self.BaseSongNameLabel = [[UILabel alloc]init];
//        self.BaseSongNameLabel.backgroundColor =[UIColor orangeColor];
        [self.contentView addSubview:self.BaseSongNameLabel];
        
        
        [_BaseImageView release];
        [_baseNumberLabel release];
        [_BaseSingerNameLabel release];
        [_BaseSongNameLabel release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    // 夜间模式判断
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setLightDayModel) name:@"LightDayNSNotification" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setNightDayModel) name:@"NightDayNSNotification" object:nil];
    
    if ([NightMode shareNightMode].isNight) {
        [self setNightDayModel];
    } else {
        [self setLightDayModel];
    }

    //    self.BaseImageView.frame = CGRectMake(30, 10, 25, 30);
    self.baseNumberLabel.frame = CGRectMake(WIDTH / 375 * 30, 8, WIDTH / 375 * 25, 48);
    self.BaseSongNameLabel.frame = CGRectMake(WIDTH / 375 * 70, 3, WIDTH / 375 * 300, 30);
    self.BaseSingerNameLabel.frame = CGRectMake(WIDTH / 375 * 70, 35, WIDTH / 375 * 320, 30);

}

- (void)setLightDayModel
{
    //    self.view.backgroundColor = [UIColor colorWithRed:216 / 255.0 green:247/ 255.0 blue:219 / 255.0 alpha:1];/////
    self.backgroundColor = [UIColor whiteColor];
    self.BaseSongNameLabel.textColor = [UIColor blackColor];
    self.BaseSingerNameLabel.textColor = [UIColor blackColor];
    self.baseNumberLabel.textColor = [UIColor blackColor];
    
}

- (void)setNightDayModel
{
    self.backgroundColor = [UIColor colorWithRed:38 / 255.0 green:38/ 255.0 blue:38 / 255.0 alpha:1];
    self.BaseSongNameLabel.textColor = [UIColor whiteColor];
    self.BaseSingerNameLabel.textColor = [UIColor whiteColor];
    self.baseNumberLabel.textColor = [UIColor whiteColor];
    
    
}

- (void)dealloc
{
    [_BaseImageView release];
    [_BaseSingerNameLabel release];
    [_BaseSongNameLabel release];
    [super dealloc];
}





- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
